package com.kujie.ai.config;//package com.kujie.config;
//
//import io.milvus.client.MilvusServiceClient;
//import io.milvus.param.*;
//import io.milvus.param.collection.DropCollectionParam;
//import org.springframework.ai.embedding.TokenCountBatchingStrategy;
//import org.springframework.ai.ollama.OllamaEmbeddingModel;
//import org.springframework.ai.vectorstore.milvus.MilvusVectorStore;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * 手动配置向量数据库
// *
// * @author check
// * @date 2025-07-25
// */
//@Configuration
//public class MilvusVectorClientConfig {
//    @Bean
//    public MilvusVectorStore vectorStore(@Autowired MilvusServiceClient milvusClient, @Autowired OllamaEmbeddingModel ollamaEmbeddingModel) {
//        // 清除缓存
//        R<RpcStatus> rpcStatusR = milvusClient.dropCollection(DropCollectionParam.newBuilder().withCollectionName("default").withDatabaseName("default").build());
//
//        return MilvusVectorStore.builder(milvusClient, ollamaEmbeddingModel)
//                .collectionName("default")
//                .databaseName("default")
//                .indexType(IndexType.IVF_FLAT)
//                .metricType(MetricType.COSINE)
//                .batchingStrategy(new TokenCountBatchingStrategy())
//                .initializeSchema(true)
//                .embeddingDimension(1024)
//                .build();
//    }
//
//    @Bean
//    public MilvusServiceClient milvusClient() {
//        return new MilvusServiceClient(ConnectParam.newBuilder().withHost("192.168.0.199").withPort(19530).build());
//    }
//}
